<template>
    <div>
        <public-header>
            <i slot="icon" class="icon-reorder" @click="showSide"></i>
            <p slot="text" class="title">vue.js中文社区</p>
            <i slot="right" class="icon-search"></i>
        </public-header>
        <side-menu v-show="show"></side-menu>
        <router-view></router-view>
        <!--<transition name="side">-->
        <div class="tab-bar">
            <router-link v-for="l in list" :to="l.uri">
                <i :class="l.class"></i>
                <p class="username">{{l.name}}</p>
            </router-link>
        </div> 
        <!--</transition>-->
    </div>
</template>

<script>
    
    import PublicHeader from '../components/Header'
    import SideMenu from './SideMenu'
    
    export default{
        data(){
            return {
                list:[
                    {name:"全部",uri:"/home",class:"icon-home"},
                    {name:"分享",uri:"/share",class:"icon-reply"},
                    {name:"问答",uri:"/edit",class:"icon-edit"},
                    {name:"招聘",uri:"/job",class:"icon-user"},
                ],
                show:false
            }
            
        },
        components:{
            PublicHeader,SideMenu
        },
        
        methods:{
            showSide(){
                this.show=!this.show
            }
            
        }
    }
</script>

<style scoped>
    .icon-reorder{
        font-size: 18px;
        margin-left: 20px;
        position: relative;
        top: 1px;
        color: #fff;
    }
    .icon-search{
        float: right;
        font-size: 18px;
        margin-right: 20px;
        position: relative;
        top: 14px;
        color: #fff;
    }
    .tab-bar{
        height: 49px;
        position: fixed;
        bottom: 0;
        border-top: 1px solid #ccc;
        background: #ebebeb;
        /*box-shadow: 0 -2px 5px rgba(0,0,0,.2);*/
        line-height: 49px;
        text-align: center;
        width: 100%;
        display: flex;
  }
  .tab-bar a{
    flex-basis: 25%;
  }
  i{
    font-size: 25px;
    position: relative;
    top: -5px;
    color: #ccc;
  }
  p.username{
    position: relative;
    top: -35px;
    font-size: 12px;
  }
  .is-active,.is-active i{
    color: #0e77e4;
  }
  .side-enter-active,.side-leave-active{
    transform: translateX(70%);
    transition: all .3s linear;
  }
  .side-enter,.side-leave-active{
    /*opacity: 0;*/
    transform: translateX(0);
  }
  
</style>